Skip to content

Conversation

@warny
Copy link
Owner

@warny warny commented Jan 12, 2026

Motivation

  • Recent refactor changed how SQL clauses were consumed and broke several SQL parsing tests due to clauses not being recognized or statement boundaries not respected.
  • Parsing of DML statements (SELECT/INSERT/UPDATE/DELETE) needed to correctly capture initial clause content and then read remaining parts in order.
  • Rebuilding SQL for DELETE sometimes emitted duplicate/misplaced targets when OUTPUT was present and needed normalization.
  • A flaky test server in OData generator tests could throw when the listener was disposed during teardown.

Description

  • Updated statement parsers (SelectStatementParser, InsertStatementParser, UpdateStatementParser, DeleteStatementParser) to first capture the initial clause using the part reader and then call ReadSegments to parse following clauses, passing ClauseStart.StatementEnd as a terminator.
  • Modified StatementParserBase.ReadSegments to provide clause terminators (including StatementEnd) to part readers so readers stop at statement end.
  • Adjusted clause part readers in SqlStatementPartReaders.cs to explicitly consume their leading keywords via TryConsumeSegmentKeyword and to handle empty results (e.g., DeletePartReader returns null when no target tokens were read).
  • Made SqlQueryAnalyzer.Parse strip a pair of surrounding quotes for certain quoted inputs and updated SqlQuery/SqlDeleteStatement binding/output logic so DELETE output formatting avoids duplicate target text when equal to the FROM expression.
  • Made the OData test helper tolerate disposed HttpListener errors by catching ObjectDisposedException alongside HttpListenerException in ServeCompressedMetadataAsync.

Testing

  • Ran the full test suite with mise exec dotnet@9.0.100 -- dotnet test Utils.sln under .NET 9.
  • Test results: all tests in the suite passed after fixes (0 failed, 645 passed, 6 skipped).
  • Verified focused runs for previously failing tests (OData generator and NNTP client/server) to ensure stability.
  • Build/pack steps invoked during dotnet test completed without errors (packages created as part of the solution build).

Codex Task

@warny warny merged commit 50b5a0b into master Jan 21, 2026
2 checks passed
@warny warny deleted the codex/corriger-tests-apres-refactoring branch January 21, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant